<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>工厂模式</title>
	</head>
	<body>
		
		<script>
			//工厂模式创建对象
			//一辆汽车  出厂 日期  [合格证、建议零售价、说明书]
			
			function createCar(name,time,certificate,price,instruction){
			    var car = new Object();
			    car.name=name;
			    car.time=time;
			    car.certificate=certificate;
			    car.price=price;
			    car.instruction = instruction;
			    car.say=function(){
			        console.log('本厂新出产品:'+this.name+',生产日期:'+this.time+',产品合格标准'+this.certificate+'零售价:'+this.price+'。说明书:'+this.instruction);
			    };
			    return car;
			};
			var car1 = createCar("路虎","2017年6月30日","巨合格","2100,000人民币","本厂车辆造价较贵，售价更贵，请爱惜");
			car1.say()
		</script>
	</body>
</html>
